public class LeetCode1736 {

    public static void main(String[] args) {
        String time = "1?:3?";

        System.out.println(maximumTimes(time));
    }

    public static String maximumTimes(String time) {
        char[] c = time.toCharArray();
        if (c[0] == '?') {
            c[0] = (c[1] >= '4' && c[1] <= '9') ? '1' : '2';
        }
        if (c[1] == '?') {
            c[1] = (c[0] == '2') ? '3' : '9';
        }
        if (c[3] == '?') {
            c[3] = '5';
        }
        if (c[4] == '?') {
            c[4] = '9';
        }
        return new String(c);
    }
}
